home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / StringCompare.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  8.3 KB  |  303 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        StringCompare.h
  3.  
  4.      Contains:    Public interfaces for String Comparison and related operations
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __STRINGCOMPARE__
  19. #define __STRINGCOMPARE__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __TEXTCOMMON__
  25. #include <TextCommon.h>
  26. #endif
  27. #ifndef __SCRIPT__
  28. #include <Script.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /*
  54.  
  55.     Here are the current System 7 routine names and the translations to the older forms.
  56.     Please use the newer forms in all new code and migrate the older names out of existing
  57.     code as maintenance permits.
  58.     
  59.     NEW NAME                    OLD NAME                    OBSOLETE FORM (no handle)
  60.     
  61.     CompareString (Str255)        IUCompPString (hp only)        IUCompString (hp only)
  62.     CompareText (ptr/len)        IUMagPString                IUMagString
  63.     IdenticalString (Str255)    IUEqualPString (hp only)    IUEqualString  (hp only)
  64.     IdenticalText (ptr/len)        IUMagIDPString                IUMagIDString
  65.     LanguageOrder                IULangOrder
  66.     ScriptOrder                    IUScriptOrder
  67.     StringOrder (Str255)        IUStringOrder (hp only)
  68.     TextOrder (ptr/len)            IUTextOrder
  69.  
  70.     RelString
  71.     CmpString (a only)                    
  72.     EqualString (hp only)
  73.     
  74.     ReplaceText
  75.  
  76. */
  77.  
  78.  
  79. enum {
  80.                                                                 /* Special language code values for Language Order*/
  81.     systemCurLang                = -2,                            /* current (itlbLang) lang for system script*/
  82.     systemDefLang                = -3,                            /* default (table) lang for system script*/
  83.     currentCurLang                = -4,                            /* current (itlbLang) lang for current script*/
  84.     currentDefLang                = -5,                            /* default lang for current script*/
  85.     scriptCurLang                = -6,                            /* current (itlbLang) lang for specified script*/
  86.     scriptDefLang                = -7                            /* default language for a specified script*/
  87. };
  88.  
  89. /* obsolete names*/
  90.  
  91. enum {
  92.     iuSystemCurLang                = -2,
  93.     iuSystemDefLang                = -3,
  94.     iuCurrentCurLang            = -4,
  95.     iuCurrentDefLang            = -5,
  96.     iuScriptCurLang                = -6,
  97.     iuScriptDefLang                = -7
  98. };
  99.  
  100.  
  101. /*
  102.    The following functions are old names, but are required for System 7 PowerPC builds
  103.    because InterfaceLib exports these names, instead of the new ones.
  104. */
  105.  
  106. EXTERN_API( short )
  107. IUMagPString                    (const void *            aPtr,
  108.                                  const void *            bPtr,
  109.                                  short                     aLen,
  110.                                  short                     bLen,
  111.                                  Handle                 itl2Handle)                            THREEWORDINLINE(0x3F3C, 0x001A, 0xA9ED);
  112.  
  113. EXTERN_API( short )
  114. IUMagIDPString                    (const void *            aPtr,
  115.                                  const void *            bPtr,
  116.                                  short                     aLen,
  117.                                  short                     bLen,
  118.                                  Handle                 itl2Handle)                            THREEWORDINLINE(0x3F3C, 0x001C, 0xA9ED);
  119.  
  120. EXTERN_API( short )
  121. IUTextOrder                        (const void *            aPtr,
  122.                                  const void *            bPtr,
  123.                                  short                     aLen,
  124.                                  short                     bLen,
  125.                                  ScriptCode             aScript,
  126.                                  ScriptCode             bScript,
  127.                                  LangCode                 aLang,
  128.                                  LangCode                 bLang)                                THREEWORDINLINE(0x3F3C, 0x0022, 0xA9ED);
  129.  
  130. EXTERN_API( short )
  131. IULangOrder                        (LangCode                 language1,
  132.                                  LangCode                 language2)                            THREEWORDINLINE(0x3F3C, 0x0020, 0xA9ED);
  133.  
  134. EXTERN_API( short )
  135. IUScriptOrder                    (ScriptCode             script1,
  136.                                  ScriptCode             script2)                            THREEWORDINLINE(0x3F3C, 0x001E, 0xA9ED);
  137.  
  138. EXTERN_API( short )
  139. IUCompPString                    (ConstStr255Param         aStr,
  140.                                  ConstStr255Param         bStr,
  141.                                  Handle                 itl2Handle);
  142.  
  143. EXTERN_API( short )
  144. IUEqualPString                    (ConstStr255Param         aStr,
  145.                                  ConstStr255Param         bStr,
  146.                                  Handle                 itl2Handle);
  147.  
  148. EXTERN_API( short )
  149. IUStringOrder                    (ConstStr255Param         aStr,
  150.                                  ConstStr255Param         bStr,
  151.                                  ScriptCode             aScript,
  152.                                  ScriptCode             bScript,
  153.                                  LangCode                 aLang,
  154.                                  LangCode                 bLang);
  155.  
  156. /*
  157.    The following new function name IS exported by InterfaceLib and works on both 68k and
  158.    System 7 PowerPC.
  159. */
  160. EXTERN_API( short )
  161. ScriptOrder                        (ScriptCode             script1,
  162.                                  ScriptCode             script2)                            THREEWORDINLINE(0x3F3C, 0x001E, 0xA9ED);
  163.  
  164. /* For C the other new names are mapped to the old names using #define.*/
  165. #if TARGET_OS_MAC
  166. #define CompareString(aStr, bStr, itl2Handle) \
  167.          IUCompPString(aStr, bStr, itl2Handle)
  168. #endif
  169. #define MacCompareString(aStr, bStr, itl2Handle) \
  170.          IUCompPString(aStr, bStr, itl2Handle)
  171. #define CompareText(aPtr, bPtr, aLen, bLen, itl2Handle) \
  172.          IUMagPString(aPtr, bPtr, aLen, bLen, itl2Handle)
  173. #define IdenticalString(aStr, bStr, itl2Handle) \
  174.          IUEqualPString(aStr, bStr, itl2Handle)
  175. #define IdenticalText(aPtr, bPtr, aLen, bLen, itl2Handle) \
  176.          IUMagIDPString(aPtr, bPtr, aLen, bLen, itl2Handle)
  177. #define StringOrder(aStr, bStr, aScript, bScript, aLang, bLang) \
  178.          IUStringOrder(aStr, bStr, aScript, bScript, aLang, bLang)
  179. #define TextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang) \
  180.          IUTextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang)
  181. #define LanguageOrder(language1, language2) \
  182.          IULangOrder(language1, language2)
  183. /* C glue*/
  184.  
  185. #if CGLUESUPPORTED
  186. #if OLDROUTINENAMES
  187. EXTERN_API_C( short )
  188. iucomppstring                    (const char *            aStr,
  189.                                  const char *            bStr,
  190.                                  Handle                 intlHandle);
  191.  
  192. EXTERN_API_C( short )
  193. iuequalpstring                    (const char *            aStr,
  194.                                  const char *            bStr,
  195.                                  Handle                 intlHandle);
  196.  
  197. EXTERN_API_C( short )
  198. iustringorder                    (const char *            aStr,
  199.                                  const char *            bStr,
  200.                                  ScriptCode             aScript,
  201.                                  ScriptCode             bScript,
  202.                                  LangCode                 aLang,
  203.                                  LangCode                 bLang);
  204.  
  205. #endif  /* OLDROUTINENAMES */
  206.  
  207. #endif  /* CGLUESUPPORTED */
  208.  
  209. /*
  210.    The following new function name IS exported by InterfaceLib and works on both 68k and
  211.    System 7 PowerPC.
  212. */
  213. #if TARGET_OS_MAC
  214.     #define MacReplaceText ReplaceText
  215. #endif
  216. EXTERN_API( short )
  217. MacReplaceText                    (Handle                 baseText,
  218.                                  Handle                 substitutionText,
  219.                                  Str15                     key)                                FOURWORDINLINE(0x2F3C, 0x820C, 0xFFDC, 0xA8B5);
  220.  
  221. EXTERN_API( short )
  222. IUMagString                        (const void *            aPtr,
  223.                                  const void *            bPtr,
  224.                                  short                     aLen,
  225.                                  short                     bLen)                                THREEWORDINLINE(0x3F3C, 0x000A, 0xA9ED);
  226.  
  227. EXTERN_API( short )
  228. IUMagIDString                    (const void *            aPtr,
  229.                                  const void *            bPtr,
  230.                                  short                     aLen,
  231.                                  short                     bLen)                                THREEWORDINLINE(0x3F3C, 0x000C, 0xA9ED);
  232.  
  233. EXTERN_API( short )
  234. IUCompString                    (ConstStr255Param         aStr,
  235.                                  ConstStr255Param         bStr);
  236.  
  237. EXTERN_API( short )
  238. IUEqualString                    (ConstStr255Param         aStr,
  239.                                  ConstStr255Param         bStr);
  240.  
  241. #if CGLUESUPPORTED
  242. #if OLDROUTINENAMES
  243. EXTERN_API_C( short )
  244. iucompstring                    (const char *            aStr,
  245.                                  const char *            bStr);
  246.  
  247. EXTERN_API_C( short )
  248. iuequalstring                    (const char *            aStr,
  249.                                  const char *            bStr);
  250.  
  251. #endif  /* OLDROUTINENAMES */
  252.  
  253. #endif  /* CGLUESUPPORTED */
  254.  
  255. EXTERN_API( short )
  256. RelString                        (ConstStr255Param         str1,
  257.                                  ConstStr255Param         str2,
  258.                                  Boolean                 caseSensitive,
  259.                                  Boolean                 diacSensitive);
  260.  
  261. EXTERN_API( Boolean )
  262. EqualString                        (ConstStr255Param         str1,
  263.                                  ConstStr255Param         str2,
  264.                                  Boolean                 caseSensitive,
  265.                                  Boolean                 diacSensitive);
  266.  
  267. #if CGLUESUPPORTED
  268. EXTERN_API_C( short )
  269. relstring                        (const char *            str1,
  270.                                  const char *            str2,
  271.                                  Boolean                 caseSensitive,
  272.                                  Boolean                 diacSensitive);
  273.  
  274. EXTERN_API_C( Boolean )
  275. equalstring                        (const char *            str1,
  276.                                  const char *            str2,
  277.                                  Boolean                 caseSensitive,
  278.                                  Boolean                 diacSensitive);
  279.  
  280. #endif  /* CGLUESUPPORTED */
  281.  
  282.  
  283. #if PRAGMA_STRUCT_ALIGN
  284.     #pragma options align=reset
  285. #elif PRAGMA_STRUCT_PACKPUSH
  286.     #pragma pack(pop)
  287. #elif PRAGMA_STRUCT_PACK
  288.     #pragma pack()
  289. #endif
  290.  
  291. #ifdef PRAGMA_IMPORT_OFF
  292. #pragma import off
  293. #elif PRAGMA_IMPORT
  294. #pragma import reset
  295. #endif
  296.  
  297. #ifdef __cplusplus
  298. }
  299. #endif
  300.  
  301. #endif /* __STRINGCOMPARE__ */
  302.  
  303.